home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / tests / rmvpptst.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  1.1 KB  |  34 lines

  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <sys/socket.h>
  4. #include <netdb.h>
  5. #include <Sender.h>
  6. #include <Receiver.h>
  7.  
  8. /* This test was written to test the Port Manager's "DisconnectFromPortMgr" function.
  9.    The program connects with the Port Manager, then waits for a return to be pressed at
  10.    the terminal.  When the return is pressed, the program formally disconnects from
  11.    the Port Manager.
  12. */
  13.  
  14. main(int argc, char** argv)
  15. {
  16.   Sender*    sender;
  17.   Receiver*    receiver;
  18.   Port        senderPort;
  19.  
  20.   printf("Starting the test.\n");
  21.   printf("Port number to connect to is %d.\n",PortMgrPortNumber);
  22.   senderPort.hostName = argv[1];
  23.   senderPort.portNumber = PortMgrPortNumber;
  24.   sender = NewSender(&senderPort);
  25.   receiver = NewReceiver(sender,argv[0],AnyPort);
  26.   printf("Connected with the Port Manager.\n");
  27.   printf("Please press the Return key to exit this program.\n");
  28.   getchar();
  29.   printf("Thank you.  Now attempting a clean break-off with the Port Manager.\n");
  30.   SenderDisconnectFromPortMgr(sender,&(receiver->receivePort));
  31.   printf("Disconnected from the Port Manager.  Exiting.\n");
  32.   exit(0);
  33. }
  34.